<?php
/**
 * Created by PhpStorm.
 * User: yangfan
 * Date: 2019/12/26
 * Time: 11:26 AM
 */

namespace App\BO\OrderStatus\State\Refund;

use App\BO\OrderStatus\Events\OrderDistributedEvent;
use App\BO\OrderStatus\State\AOrderState;

class RefundAdminRejectState extends AOrderState
{
    /**
     * 实际状态
     * @var string
     */
    protected $state = '管理员拒绝退款';

    /**
     * 前端显示用
     * @var string
     */
    protected $desc = '待分配';

    /**
     * @return bool
     */
    public function couldDistribute()
    {
        return true;
    }

    /**
     * @return bool
     */
    public function hasRefundInfo()
    {
        return true;
    }

    /**
     * 分配操作
     * @return mixed|void
     * @throws \Exception
     */
    public function distribute()
    {
        $this->toWaitingService();
        event(new OrderDistributedEvent($this->stateContext->getOrder()));  // 订单已经分配过了，待服务
    }
}
